package edu.umd.ion.wavemeter.server;

import java.util.Iterator;
import java.util.TreeSet;

import edu.umd.ion.wavemeter.service.InterlockSettings;

public class VirtChannelData {
	//public long UnderexposedSince;
	private InterlockSettings Interlock;
	public long LastChannelRequest;
	TreeSet<String> Names;
	int InterlockSerial;
	RunnableOne<Integer> InterlockSerialReceiver;
	
	public VirtChannelData(RunnableTwo<Integer, Integer> interlockSerialReceiver) {
		Names = new TreeSet<String>();
	}
	
	public String concatenatedNames() {
		String s = new String();
		Iterator<String> p=Names.iterator();
		if (p.hasNext()) {
			s += p.next();
		}
		while ( p.hasNext()) {
			s += ", "+p.next();
		}
		return s;
	}

	public InterlockSettings getInterlock() {
		return Interlock;
	}

	public void setInterlock(InterlockSettings interlock) {
		Interlock = interlock;
		Interlock.Serial =	++InterlockSerial;
	}
}
